package com.devops.config;


import com.devops.entity.resp.ResponseResult;
import com.devops.utils.ResponseUtils;
import com.devops.utils.error.ReturnErrorException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(value = ReturnErrorException.class)
    @ResponseBody
    public ResponseResult handleReturnErrorException(ReturnErrorException e) {
        return ResponseUtils.error(e.getErrorList());
    }

}
